using CMS.Entity;
using CMS.Repository;

namespace CMS.Service.Impl;

public class UserService(IUserRepository userRepository) : BaseService<User>(userRepository), IUserService {
    public IQueryable<User> GetSearchPage(UserSearch search, IQueryable<User> users) {
        if (!string.IsNullOrEmpty(search.UserName)) {
            users = users.Where(u => u.UserName!.Contains(search.UserName));
        }
        if (!string.IsNullOrEmpty(search.UserEmail)) {
            users = users.Where(u => u.UserEmail!.Contains(search.UserEmail));
        }
        return users;
    }
}